package com.dfrz.ch10.object;

import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundFault;

import java.util.Objects;

/**
 * 作者：wangmaokang
 * 日期: 2021/4/20 15:35
 * 描述:
 */
public class Fish extends Object   {
    private String name;
    private int age;

    @Override
    public String toString() {
        return "Fish{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o){ return true;}
        Fish fish = (Fish) o;
        if (this.name.equals(fish.getName())&&this.age==fish.getAge()){
            return true;
        }else {
            return  false;
        }
    }

    @Override
    public int hashCode() {
        int result = getName() != null ? getName().hashCode() : 0;
        result = 31 * result + getAge();
        return result;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }


    public Fish(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
